home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK1.toast / Development Kits (Disc 1) / QuickTime / Programming Stuff / Documentation / develop articles / develop Issue 14 / Derived Media Handlers code / MyMediaComponent / MyMemory.c < prev    next >
Encoding:
Text File  |  1993-02-25  |  1.1 KB  |  62 lines  |  [TEXT/KAHL]

  1. //--------------------------------------------------------------------------
  2. //
  3. //        MyMemory.c
  4. //            by John Wang
  5. //
  6. //        Version:    1.0        05/22/92    Completed.
  7. //                    1.01    11/03/92    Cleaned up.
  8. //                    1.02    01/13/93    Fixed broken MyDisposeHandle and MyDisposePtr from 1.01
  9. //                    1.03    01/31/93    Added MyGetHandleSize which returns 0 if nil handle
  10. //                    1.04    02/25/93    Hopefully last 1.0
  11. //
  12. //--------------------------------------------------------------------------
  13.  
  14. #include    "MyMemory.h"
  15.  
  16. //--------------------------------------------------------------------------
  17.  
  18. pascal Handle MyNewHandle(Size byteCount)
  19. {
  20.     return(NewHandle(byteCount));
  21. }
  22.  
  23. pascal Handle MyNewHandleClear(Size byteCount)
  24. {
  25.     return(NewHandleClear(byteCount));
  26. }
  27.  
  28. pascal void MyDisposeHandle(Handle *h)
  29. {
  30.     if (*h) {
  31.         DisposeHandle(*h);
  32.         *h = nil;
  33.     }
  34. }
  35.  
  36. pascal long MyGetHandleSize(Handle h)
  37. {
  38.     if (h) {
  39.         return(GetHandleSize(h));
  40.     } else {
  41.         return(0);
  42.     }
  43. }
  44.  
  45. pascal Ptr MyNewPtr(Size byteCount)
  46. {
  47.     return(NewPtr(byteCount));
  48. }
  49.  
  50. pascal Ptr MyNewPtrClear(Size byteCount)
  51. {
  52.     return(NewPtrClear(byteCount));
  53. }
  54.  
  55. pascal void MyDisposePtr(Ptr *p)
  56. {
  57.     if (*p) {
  58.         DisposePtr(*p);
  59.         *p = nil;
  60.     }
  61. }
  62.